{template 'public/header'}
{template 'public/comhead'}
{if $operation == 'display'}
<script>
require(['bootstrap'],function($){
	$('.btn,.tips').hover(function(){
		$(this).tooltip('show');
	},function(){
		$(this).tooltip('hide');
	});
});
</script>
<div class="main">
<style>
.form-control-excel {height: 34px;padding: 6px 12px;font-size: 14px;line-height: 1.42857143;color: #555;background-color: #fff;background-image: none;border: 1px solid #ccc;border-radius: 4px;-webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);box-shadow: inset 0 1px 1px rgba(0,0,0,.075);-webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;}
</style>
    <div class="panel panel-info">
        <div class="panel-heading">筛选</div>
        <div class="panel-body">
            <form action="./index.php" method="get" class="form-horizontal" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="fm_jiaoyu" />
                <input type="hidden" name="do" value="allcamera" />
				<input type="hidden" name="schoolid" value="{$schoolid}" />
				<div class="form-group">
					<a style="margin-left:40px;" class="btn btn-primary" href="{php echo $this->createWebUrl('allcamera', array('op' => 'post', 'schoolid' => $schoolid))}"><i class="fa fa-plus"></i> 添加画面</a>
				</div>
                <div class="form-group">
                    <label class="col-xs-12 col-sm-2 col-md-2 col-lg-1 control-label" style="width: 100px;">关键字</label>
                    <div class="col-sm-2 col-lg-2">
                        <input class="form-control" name="keyword" id="" type="text" value="{$_GPC['keyword']}">
                    </div>
<!-- 					<label class="col-xs-12 col-sm-2 col-md-2 col-lg-2 control-label" style="width: 100px;">按班级</label>
                    <div class="col-sm-2 col-lg-2">
                        <select style="margin-right:15px;" name="bj_id" class="form-control">
                            <option value="0">请选择班级搜索</option>
                            {loop $bj $row}
                            <option value="{$row['sid']}" {if $row['sid'] == $_GPC['bj_id']} selected="selected"{/if}>{$row['sname']}</option>
                            {/loop}
                        </select>
                    </div> -->					
                    <div class="col-sm-2 col-lg-2">
                        <button class="btn btn-default"><i class="fa fa-search"></i>搜索</button>
                    </div>
                </div>				
            </form>
        </div>
    </div>
    <div class="panel panel-default">
        <div class="table-responsive panel-body">
        <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
		<input type="hidden" name="schoolid" value="{$schoolid}" />
        <table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
                    <th style="width: 20px;"></th>
					<th style="width:5%">排序</th>
					<th style="width:15%">封面</th>
                    <th style="width:8%;">状态</th>
					<th style="width:13%;">观看时段</th>
					<th style="width:8%;">观看</th>
					<th style="width:8%;">点赞</th>
                    <th style="width:7%;">创建时间</th>	
                    <th style="width:8%;">评论</th>					
					<th style="text-align:right; width:8%;">操作</th>
				</tr>
			</thead>
			<tbody>
				{loop $list $item}
				<tr>
                    <td class="with-checkbox"><input type="checkbox" name="check" value="{$item['id']}"></td>
					<td>
                        {$item['ssort']}
                    </td>
					<td>
						<img style="width:100px;height:45px;" src="{if !empty($item['videopic'])}{php echo tomedia($item['videopic'])}{else}{php echo tomedia($logo['logo'])}{/if}" width="50"/>
						</br><h4>{$item['name']}</h4>
                    </td>	
					<td>
                        {if $item['allowpy'] ==1}<span class="label label-success">允许评论</span>{else}<span class="label label-danger">禁止评论</span>{/if}
                    </td>
                    <td>
                        {$item['starttime']}至{$item['endtime']}
                    </td>					
                    <td>
                        {$item['click']}次
                    </td>
                    <td>
                        {$item['dianzan']}次
                    </td>					
					<td>{php echo date('Y-m-d',$item['createtime'])}</td>  					
                    <td>
					 {$item['plsl']}条
					{if $item['plsl'] > 0}
						</br>
						<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('allcamera', array('id' => $item['id'], 'op' => 'pllist', 'schoolid' => $schoolid))}" title="评论">
							<i class="fa fa-qrcode">&nbsp;&nbsp;查看评论</i>
						</a>
					{/if}	
					</td>					
					<td style="text-align:right;">
						<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('allcamera', array('id' => $item['id'], 'op' => 'post', 'schoolid' => $schoolid))}" title="编辑"><i class="fa fa-pencil"></i></a>&nbsp;&nbsp;<a class="btn btn-default btn-sm" href="{php echo $this->createWebUrl('allcamera', array('id' => $item['id'], 'op' => 'delete', 'schoolid' => $schoolid))}" onclick="return confirm('此操作不可恢复，确认删除？');return false;" title="删除"><i class="fa fa-times"></i></a>
					</td>
				</tr>
				{/loop}
			</tbody>
			<tr>
				<td colspan="10">
					<input name="token" type="hidden" value="{$_W['token']}" />
				</td>
			</tr>
		</table>
        {$pager}
    </form>
        </div>
    </div>
</div>
<script type="text/javascript">
<!--
	var category = {php echo json_encode($children)};
//-->
$(function(){
    $(".check_all").click(function(){
        var checked = $(this).get(0).checked;
        $("input[type=checkbox]").attr("checked",checked);
    });

    $("input[name=btndeleteall]").click(function(){
        var check = $("input[type=checkbox][class!=check_all]:checked");
        if(check.length < 1){
            alert('请选择要删除的学生!');
            return false;
        }
        if(confirm("确认要删除选择的学生?")){
            var id = new Array();
            check.each(function(i){
                id[i] = $(this).val();
            });
            var url = "{php echo $this->createWebUrl('students', array('op' => 'deleteall', 'schoolid' => $schoolid))}";
            $.post(
                url,
                {idArr:id},
                function(data){
                    if(data.result){
					    alert(data.msg);
                        location.reload();
                    }else{
                        alert(data.msg);
                    }
                },'json'
            );
        }
    });

});
</script>
{elseif $operation == 'post'}
<div class="panel panel-info">
   <div class="panel-heading"><a class="btn btn-primary" onclick="javascript :history.back(-1);"><i class="fa fa-tasks"></i> 返回</a></div>
</div>
<div class="main">
    <form action="" method="post" class="form-horizontal form" enctype="multipart/form-data">
        <input type="hidden" name="id" value="{$item['id']}" />	
		<input type="hidden" name="schoolid" value="{$schoolid}" />
        <div class="panel panel-default">
            <div class="panel-heading">
                编辑{$logo['videoname']}信息
            </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">排序</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="ssort" class="form-control" value="{$item['ssort']}" />
							<span class="help-block">值越大越靠前</span>
                        </div>
                    </div>
                </div>			
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">{$logo['videoname']}名称</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="name" class="form-control" value="{$item['name']}" />
                        </div>
                    </div>
                </div>
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">封面图片</label>
                    <div class="col-sm-9">					 
                        {php echo tpl_form_field_image('videopic', $item['videopic'])}		
                        <span class="help-block">显示在前端视频列表页面，尺寸建议333*120</span>
                    </div>
                </div>
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">推流地址</label>
                    <div class="col-sm-9">
                        <input type="text" name="videourl" class="form-control" value="{$item['videourl']}" />
						<span class="help-block">配置方法见商业群文件</span>
                    </div>
                </div>
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">允许评论</label>
                    <div class="col-sm-9">
                        <label for="isshow1" class="radio-inline"><input type="radio" name="allowpy" value="1" id="isshow1" {if empty($item) || $item['allowpy'] == 1}checked="true"{/if} /> 允许</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="isshow2" class="radio-inline"><input type="radio" name="allowpy" value="2" id="isshow2"  {if !empty($item) && $item['allowpy'] == 2}checked="true"{/if} /> 拒绝</label>
                        <span class="help-block"></span>
                    </div>
                </div>				
				<div class="form-group">
					<label class="col-xs-12 col-sm-3 col-md-2 control-label">监控可用时间段</label>
					<div class="col-sm-9 col-xs-9 col-md-4">
						<div class="input-group clockpicker" style="margin-bottom: 15px">
							{php echo tpl_form_field_clock('starttime', $item['starttime'])}
							<span class="input-group-addon">至</span>
							{php echo tpl_form_field_clock('endtime', $item['endtime'])}
							<span class="input-group-addon"></span>
						</div>
					</div>
				</div>
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">类型</label>
                    <div class="col-sm-9">
                        <label for="isshow3" class="radio-inline"><input type="radio" name="videotype" value="1" id="isshow3" {if empty($item['videotype']) || $item['videotype'] == 1}checked="true"{/if} /> 指定班级</label>
                        &nbsp;&nbsp;&nbsp;
                        <label for="isshow4" class="radio-inline"><input type="radio" name="videotype" value="2" id="isshow4"  {if !empty($item) && $item['videotype'] == 2}checked="true"{/if} /> 公共区域</label>
                        <span class="help-block">指定班级或者设定为全校可看</span>
                    </div>
                </div>
				<div id="credit-status1" {if empty($item['videotype']) || $item['videotype'] == 1}style="display:block"{else}style="display:none"{/if}>
					<div class="form-group">
						<label class="col-xs-12 col-sm-3 col-md-2 control-label">选择班级</label>
						<div class="col-sm-9 col-xs-6">
							<div class="input-group text-info">
								{loop $banji $uni}
								{php $is = $this->uniarr($uniarr,$uni['sid']);}
										<label for="uni_{$uni['sid']}" class="checkbox-inline">
										<input id="uni_{$uni['sid']}" type="checkbox" name="arr[]" value="{$uni['sid']}"{if ($is)}checked="checked"{/if}> {$uni['sname']}
										</label>
								{/loop}
							</div>
							<div class="help-block">选择要应用到的班级</div>
						</div>
					</div>
				</div>		
                <div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">点击量</label>
                    <div class="col-sm-9">
                        <div class="input-group">
                            <input type="text" name="click" class="form-control" value="{$item['click']}" />
							<span class="help-block">可修改</span>
                        </div>
                    </div>
                </div>				
				<div class="form-group">
                    <label class="col-xs-12 col-sm-3 col-md-2 control-label">视频描述</label>
                    <div class="col-sm-9">
                        <textarea style="height:150px;" class="form-control richtext" name="conet" cols="70">{$item['conet']}</textarea>
                        <span class="help-block">可为空,前端暂未调用</span>
                    </div>
                </div>		   
            </div>
        </div>
        <div class="form-group col-sm-12">
            <input type="submit" name="submit" value="提交" class="btn btn-primary col-lg-1" />
            <input type="hidden" name="token" value="{$_W['token']}" />
        </div>
    </form>
</div>
<script type="text/javascript">
	$('#isshow3').click(function(){
		$('#credit-status1').show();
	});
	$('#isshow4').click(function(){
		$('#credit-status1').hide();
	});
</script>	
{elseif $operation == 'pllist'}
<div class="panel panel-info">
	<div class="panel-heading"><a class="btn btn-primary" href="javascript:history.go(-1);"><i class="fa fa-tasks"></i>返回列表</a></div>
</div>
<div class="panel panel-default">
	<div class="table-responsive panel-body">
		<table class="table">
			<thead>
				<tr>
					<th class='with-checkbox' style="width: 20px;"><input type="checkbox" class="check_all" /></th>
					<th style="width:8%">发表</th>
					<th style="width:40%;">内容</th>
					<th style="width:10%;">发布时间</th>
					<!--th style="width:150px; text-align:right;">操作</th-->
				</tr>
			</thead>
			<tbody>
				{loop $allpl $item}
				<tr>
					<td class="with-checkbox"><input type="checkbox" name="check" value="{$item['id']}"></td>
					<td>
						<span class="label label-success"><i class="fa fa-user"></i></span>【{$item['name']}】
					</td>	
					<td>
						{$item['conet']}
					</td>					
					<td>
						<span class="label label-success">{php echo date('Y-m-d H:m:s',$item['createtime'])}</span>
					</td>
				</tr>
				{/loop}
			</tbody>
		</table>
		<tr>
			<td colspan="10">
				<input name="token" type="hidden" value="{$_W['token']}" />
				<input type="button" class="btn btn-primary" name="btndeleteall" value="批量删除" />
			</td>
		</tr>		
	</div>
</div>
{$pager}
{/if}
<script type="text/javascript">
$(function(){
    $(".check_all").click(function(){
        var checked = $(this).get(0).checked;
        $("input[type=checkbox]").attr("checked",checked);
    });

    $("input[name=btndeleteall]").click(function(){
        var check = $("input[type=checkbox][class!=check_all]:checked");
        if(check.length < 1){
            alert('请选择要删除的内容!');
            return false;
        }
        if(confirm("确认要删除选择的内容?")){
            var id = new Array();
            check.each(function(i){
                id[i] = $(this).val();
            });
            var url = "{php echo $this->createWebUrl('allcamera', array('op' => 'deleteall','schoolid' => $schoolid))}";
            $.post(
                url,
                {idArr:id},
                function(data){
                    if(data.result){
					    alert(data.msg);
                        location.reload();
                    }else{
                        alert(data.msg);
                    }
                },'json'
            );
        }
    });

});
</script>
{template 'public/footer'}